package com.pb.wkflow.core.utils;

/**
 * @author 苗益辉
 * @date 2022/4/9 12:54
 */
public class StringUtils {

    private StringUtils() {

    }

    public static boolean isBlank(String s) {
        return null == s || "".equals(trim(s));
    }

    public static boolean isNotBlank(String s) {
        return null != s && !"".equals(trim(s));
    }

    public static String trim(String s) {
        return s.trim();
    }

    public static boolean equals(CharSequence str, CharSequence str1) {
        if(str == str1) {
            return true;
        }else if (str != null && str1 != null) {
            if(str.length() != str1.length()) {
                return false;
            }else if (str instanceof String && str1 instanceof String) {
                return str.equals(str1);
            }else {
                int length = str.length();

                for(int i = 0; i < length; i++) {
                    if(str.charAt(i) != str1.charAt(i)) {
                        return false;
                    }
                }
                return true;
            }
        }else {
            return false;
        }
    }
}
